|
|
Hello. Thank you for reading. I need help with my matrixing. I know
everybody else here understands them and/or owns a TI-86 and/or equivalent.
I have neither. I don't care about the calculator (the Casio fx-570s offers
everything I need), but I do care about matrix. I hope I can explain this.
Let me see... ok.
Given 2 points in 2D* or 3D space, A and B, how can I make an object rotate
to line itself up to the line AB? My intention is to give an object a path
to follow over an uneven surface, and using the trace() function on the
front and back of the object, generate the points A and B to help my object
avoid obstacles. A third trace() would be taken from the center of the
object, C, and the point (A,B or C) that has the highest y determines how
high the object is placed over the path.
Right now I am using (and it doesn't work right, so that's why I'm here) the
following macro:
#macro apunta(A,B)
#declare X=vnormalize(B-A);
#declare Z=vnormalize(vcross(X,y));
#declare Y=vcross(Z,X);
matrix
<
X.x,X.y,X.z,
Y.x,Y.y,Y.z,
Z.x,Z.y,Z.z,
A.x,A.y,A.z
>
#end
Given:
#declare A = <0,2,1>;
#declare B = <0,1,-1>;
sphere {A,1/2 pigment {rgb <1,1,0>}}
sphere {B,1/2 pigment {rgb <0,1,1>}}
box
{
<1,1,2>,-<1,1,2>
pigment {red 1}
aim(y,B)
translate y*(Y+2)
}
Why doesn't it work right?
* I say 2D, because sometimes I might write the points as in the example
given.
--
Anthony Bennett
Post a reply to this message
|
|